Image processing method, image processing device, electronic device and storage medium

ABSTRACT

An image processing method, an image processing device, an electronic device, and a non-transitory computer readable storage medium are provided. The image processing method includes: obtaining an input image which includes M character rows; performing global correction processing on the input image to obtain an intermediate corrected image; determining the M character row lower boundaries corresponding to the M character rows according to the intermediate corrected image; and determining the local adjustment reference line and M retention coefficient groups based on the intermediate corrected image and the M character row lower boundaries; determining M local adjustment offset groups corresponding to the M character rows according to the M character row lower boundaries, the local adjustment reference line and the M retention coefficient groups; performing local adjustment on the M character rows in the intermediate corrected image according to the M local adjustment offset groups to obtain the target corrected image.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims the priority benefit of China application serialno. 202010632679.1, filed on Jul. 2, 2020. The entirety of theabove-mentioned patent application is hereby incorporated by referenceherein and made a part of this specification.

BACKGROUND Field of the Disclosure

The embodiments of the present disclosure relate to an image processingmethod, an image processing device, an electronic device, and anon-transitory computer readable storage medium.

Description of Related Art

With the development of digital technology, paper files can be scannedor photographed to be converted into electronic text images, which canbe easily stored and transmitted through the Internet. In addition, thetext image can be recognized by text recognition technology to obtainthe information recorded in the text image. However, in the process ofconverting a paper file into a text image, the text image may beinclined, etc., and the inclination will have an adverse effect on theanalysis (for example, text recognition, etc.) of the text image.Therefore, it is necessary to correct the text image so that theinformation recorded in the text image can be stored and transmittedmore accurately.

SUMMARY OF THE DISCLOSURE

At least one embodiment of the present disclosure provides an imageprocessing method, including: obtaining an input image, wherein theinput image includes M character rows, each character row in the Mcharacter rows includes at least one character, and M is a positiveinteger; performing the global correction processing on the input imageto obtain an intermediate corrected image; performing the localadjustment on the intermediate corrected image to obtain a targetcorrected image. The step of performing the local adjustment on theintermediate corrected image to obtain a target corrected imageincludes: determining the M character row lower boundaries correspondingto the M character rows according to the intermediate corrected image;and determining the local adjustment reference line and M retentioncoefficient groups based on the intermediate corrected image and the Mcharacter row lower boundaries, wherein each retention coefficient groupin the M retention coefficient groups includes multiple retentioncoefficients; determining M local adjustment offset groups correspondingto the M character rows according to the M character row lowerboundaries, the local adjustment reference line and the M retentioncoefficient groups, wherein each local adjustment offset group in the Mlocal adjustment offset groups includes multiple local adjustmentoffsets; performing local adjustment on the M character rows in theintermediate corrected image according to the M local adjustment offsetgroups to obtain the target corrected image.

For example, in the image processing method provided by an embodiment ofthe present disclosure, the step of determining the M character rowlower boundaries corresponding to the M character rows according to theintermediate corrected image includes: performing the characterconnection processing on the intermediate corrected image to obtain afirst character connected image, wherein the first character connectedimage includes M first character connected areas corresponding to the Mcharacter rows; and determining the M character row lower boundariescorresponding to the M character rows according to the M first characterconnected areas and the intermediate corrected image.

For example, in the image processing method provided by an embodiment ofthe present disclosure, the step of determining the M character rowlower boundaries corresponding to the M character rows according to theM first character connected areas and the intermediate corrected imageincludes: determining the M area lower boundaries corresponding to the Mfirst character connected areas one-to-one; performing the boundaryfitting processing on the M character rows to obtain the M character rowlower boundaries according to the M area lower boundaries and theintermediate corrected image, wherein the M character rows include thei1-th character row, the i1-th character row corresponds to the firstcharacter connected area which corresponds to the lower boundary of thei1-th area in the M area lower boundaries, it is a positive integer lessthan or equal to M. The step of performing the boundary fitting processon the i1-th character row includes: obtaining at least one pixel ofeach character in the i1-th character row closest to the lower boundaryof the i1-th area; removing the noise pixel in the at least one pixel toobtain the target pixel; performing the linear or quadratic fitting onthe target pixel to obtain the character row lower boundarycorresponding to the i1-th character row.

For example, in the image processing method provided by an embodiment ofthe present disclosure, the step of determining the M local adjustmentoffset groups corresponding to the M character rows according to the Mcharacter row lower boundaries, the local adjustment reference line andthe M retention coefficient groups includes: determining the M localadjustment reference points corresponding to the M character row lowerboundaries according to the local adjustment reference line; for thei2-th character row lower boundary in the M character row lowerboundaries, determining the local adjustment reference pointcorresponding to the i2-th character row lower boundary in the M localadjustment reference points, wherein i2 is a positive integer less thanor equal to M; determining the i2-th character row corresponding to thei2-th character row lower boundary in the M character rows; determiningthe local character row area corresponding to the i2-th character rowaccording to the height of the character rows and the i2-th characterrow; determining the multiple reference character offsets correspondingto the i2-th character row lower boundary according to the i2-thcharacter row lower boundary and the local adjustment reference pointcorresponding to the i2-th character row lower boundary; in response tothat the local character row area corresponding to the i2-th characterrow does not overlap the local character row area corresponding to anyone of remaining character row in the M character rows, determining thelocal adjustment offset corresponding to each pixel in the localcharacter row area corresponding to the i2-th character row according tothe multiple reference character offsets corresponding to the i2-thcharacter row and the retention coefficient group corresponding to thelocal character row area corresponding to the i2-th character row in theM retention coefficient groups, wherein the M local adjustment offsetgroups include a local adjustment offset group corresponding to thei2-th character row, and the local adjustment offset group correspondingto the i2-th character row includes the local adjustment offsetcorresponding to each pixel in the local character row areacorresponding to the i2-th character row.

For example, in the image processing method provided by an embodiment ofthe present disclosure, the step of determining the M local adjustmentoffset groups corresponding to the M character rows according to the Mcharacter row lower boundaries, the local adjustment reference line andthe M retention coefficient groups further includes: for the i3-thcharacter row lower boundary in the M character row lower boundaries,determining the local adjustment reference point corresponding to thei3-th character row lower boundary in the M local adjustment referencepoints, wherein i3 is a positive integer less than or equal to M, i2 andi3 are not equal to each other; determining the i3-th character rowcorresponding to the i3-th character row lower boundary in the Mcharacter rows; determining the local character row area correspondingto the i3-th character row according to the height of the character rowand the i3-th character row; determining the multiple referencecharacter offsets corresponding to the i3-th character row according tothe i3-th character row lower boundary and the local adjustmentreference point corresponding to the i3-th character row lower boundary;in response to that the local character row area corresponding to thei2-th character row partially overlaps the local character row areacorresponding to the i3-th character row: for the overlapped areabetween the local character row area corresponding to the i2-thcharacter row and the local character row area corresponding to thei3-th character row, determining the local adjustment offset of eachpixel in the overlapped area according to the multiple referencecharacter offsets corresponding to the i2-th character row and themultiple reference character offsets corresponding to the i3-thcharacter row, for each pixel in the non-overlapped area outside theoverlapped area in the local character area corresponding to the i2-thcharacter row, determining the local adjustment offset corresponding toeach pixel in the non-overlapped area of the local character row areacorresponding to the i2-th character row according to the multiplereference character offsets corresponding to the i2-th character row andthe retention coefficient group corresponding to the local character rowarea corresponding to the i2-th character row in the M retentioncoefficient groups, wherein the local adjustment offset groupcorresponding to the i2-th character row in the M local adjustmentoffset groups includes the local adjustment offset corresponding to eachpixel in the non-overlapped area of the local character row areacorresponding to the i2-th character row and the local adjustment offsetof each pixel in the overlapped area; for each pixel in thenon-overlapped area outside the overlapped area in the local characterrow area corresponding to the i3-th character row, determining the localadjustment offset corresponding to each pixel in the non-overlapped areain the local character row area corresponding to the i3-th character rowaccording to the multiple reference character offsets corresponding tothe i3-th character row and the retention coefficient groupscorresponding to the local character row area corresponding to the i3-thcharacter row in the M coefficient groups, wherein the local adjustmentoffset group offset groups corresponding to the i3-th character rowincludes the local adjustment offset corresponding to each pixel in thenon-overlapped area of the local character row area corresponding to thei3-th character row and the local adjustment offset of each pixel in theoverlapped area.

For example, in the image processing method provided by an embodiment ofthe present disclosure, the step of determining the M local adjustmentreference points corresponding to the M character row lower boundariesaccording to the local adjustment reference line includes for each ofthe M character row lower boundaries, under the condition that there isan intersection between the character row lower boundary and the localadjustment reference line, determining the local adjustment referencepoint corresponding to the character row lower boundary as theintersection; under the condition that there is no intersection betweenthe character row lower boundary and the local adjustment referenceline, determining the local adjustment reference point corresponding tothe character row lower boundary as the point on the character row lowerboundary closest to the local adjustment reference line.

For example, in the image processing method provided by an embodiment ofthe present disclosure, the value range of the retention coefficient ineach of the retention coefficient groups is 0 to 1, and the step ofdetermining the M retention coefficient groups includes: for the i4-thcharacter row in the M character rows, determining the local characterrow area corresponding to the i4-th character row, wherein i4 is apositive integer less than or equal to M; for each pixel in the localcharacter row area, obtaining the point on the character row lowerboundary corresponding to the i4-th character row closest to the pixelas the reference pixel; determining the attenuation value correspondingto the pixel according to the distance between the pixel and thereference pixel; determining the retention coefficient corresponding tothe pixel according to the attenuation value, thereby determining theretention coefficient group corresponding to the local character rowarea corresponding to the i4-th character row, wherein the M retentioncoefficient groups include the retention coefficient groupscorresponding to local character row area corresponding to the i4-thcharacter row.

For example, in the image processing method provided by an embodiment ofthe present disclosure, the M character rows are arranged along a firstdirection, and the step of determining the local adjustment referenceline includes: using the middle line extending in the first direction inthe intermediate corrected image as the local adjustment reference line.

For example, in the image processing method provided by an embodiment ofthe present disclosure, the step of performing local adjustment on the Mcharacter rows in the intermediate corrected image according to the Mlocal adjustment offset groups to obtain the target corrected imageincludes: determining the local character row area corresponding to theM character rows in the intermediate corrected image; performing thelinear local adjustment on the pixels in the local character row areacorresponding to the M character rows respectively to obtain the targetcorrected image according to the M local adjustment offset group.

For example, in the image processing method provided by an embodiment ofthe present disclosure, the step of performing the global correctionprocessing on the input image to obtain an intermediate corrected imageincludes: performing the binarization processing on the input image toobtain a binarized image; performing the character connection processingon the binarized image to obtain a second character connected image,wherein the second character connected image includes M second characterconnected areas corresponding to the M character rows; acquiring Mmiddle lines corresponding to the M second character connected areasone-to-one, wherein the M second character connected areas are arrangedalong the first direction; setting W first division lines, wherein Wfirst division lines extend along the first direction; acquiringmultiple first intersections between the M middle lines and the W firstdivision lines; performing a quadratic fitting based on the multiplefirst intersections to obtain W quadratic functions corresponding to theW first division lines one-to-one; setting the Q second division lines,wherein the Q second division lines extend along the second direction,and the first direction and the second direction are perpendicular toeach other; obtaining multiple second intersections between the W firstdivision lines and the Q second division lines; calculating the globaladjustment offset of the multiple second intersections based on the Wquadratic functions; performing the global correction processing on thebinarized image according to the global adjustment offset of themultiple second intersections to obtain the intermediate correctedimage.

For example, in the image processing method provided by an embodiment ofthe present disclosure, the step of performing the quadratic fittingbased on the multiple first intersections to obtain W quadraticfunctions corresponding to the W first division lines one-to-oneincludes determining a coordinate system based on the input image,wherein the coordinate system includes an X axis and a Y axis, the firstdirection is parallel to the Y axis, and the second direction isparallel to the X axis; determining the coordinate value of the multiplecharacter center points corresponding to the first intersections in thecoordinate system; calculating the global adjustment offset of themultiple first intersections based on the multiple character centerpoints; performing the quadratic fitting on the global adjustment offsetof the multiple first intersections to obtain the W quadratic functionscorresponding to the W first division lines one-to-one.

For example, in the image processing method provided by an embodiment ofthe present disclosure, for each first intersection in the multiplefirst intersections, the global adjustment offset of the firstintersection includes the difference between the Y-axis coordinate valueof the first intersection in the coordinate system and the Y-axiscoordinate value of the character center point corresponding to thefirst intersection in the coordinate system.

At least one embodiment of the present disclosure provides an imageprocessing device, including: an acquisition module for obtaining aninput image, wherein the input image includes M character rows, and eachcharacter row in the M character rows includes at least one character,and M is a positive integer; a global correction module configured toperform the global correction processing on the input image to obtain anintermediate corrected image; a local adjustment module configured toperform the local adjustment on the intermediate corrected image toobtain the target corrected image; wherein the step of performing thelocal adjustment on the intermediate corrected image by the localadjustment module to obtain the target corrected image includes thefollowing operations: determining the M character row lower boundariescorresponding to the M character rows according to the intermediatecorrected image; determining the local adjustment reference line and Mretention coefficient groups based on the intermediate corrected imageand the M character row lower boundaries, wherein each retentioncoefficient group in the M retention coefficient groups includesmultiple retention coefficients; determining M local adjustment offsetgroups corresponding to the M character rows according to the Mcharacter row lower boundaries, the local adjustment reference line andthe M retention coefficient groups, wherein each local adjustment offsetgroup in the M local adjustment offset groups includes multiple localadjustment offsets; performing the local adjustment on the M characterrows in the intermediate corrected image according to the M localadjustment offset groups to obtain the target corrected image.

For example, in the image processing device provided by an embodiment ofthe present disclosure, the operation of determining, by the localadjustment module, the M character row lower boundaries corresponding tothe M character rows according to the intermediate corrected imageincludes the following operations: performing the character connectionprocessing on the intermediate corrected image to obtain a firstcharacter connected image, wherein the first character connected imageincludes M first character connected areas corresponding to the Mcharacter rows; and determining the M character row lower boundariescorresponding to the M character rows according to the M first characterconnected areas and the intermediate corrected image.

For example, in the image processing device provided by an embodiment ofthe present disclosure, the operation of determining, by the localadjustment module, the M character row lower boundaries corresponding tothe M character rows according to the M first character connected areasand the intermediate corrected image includes the following operations:determining the M area lower boundaries corresponding to the M firstcharacter connected areas one-to-one; performing the boundary fittingprocessing on the M character rows to obtain the M character row lowerboundaries according to the M area lower boundaries and the intermediatecorrected image, wherein the M character rows include the i1-thcharacter row, the i1-th character row corresponds to the firstcharacter connected area which corresponds to the lower boundary of thei1-th area in the M area lower boundaries, i1 is a positive integer lessthan or equal to M. The operation of performing the boundary fittingprocess on the i1-th character row includes: obtaining at least onepixel of each of the at least one character in the it-th character rowclosest to the lower boundary of the i1-th area; removing the noisepixel in the at least one pixel to obtain the target pixel; performingthe linear or quadratic fitting on the target pixel to obtain thecharacter row lower boundary corresponding to the i1-th character row.

For example, in the image processing device provided by an embodiment ofthe present disclosure, the operation of determining, by the localadjustment module, the M local adjustment offset groups corresponding tothe M character rows according to the M character row lower boundaries,the local adjustment reference line and the M retention coefficientgroups includes the following operations: determining the M localadjustment reference points corresponding to the M character row lowerboundaries according to the local adjustment reference line; for thei2-th character row lower boundary in the M character row lowerboundaries, determining the local adjustment reference pointcorresponding to the i2-th character row lower boundary in the M localadjustment reference points, wherein i2 is a positive integer less thanor equal to M; determining the i2-th character row corresponding to thei2-th character row lower boundary in the M character rows; determiningthe local character row area corresponding to the i2-th character rowaccording to the height of the character rows and the i2-th characterrow; determining the multiple reference character offsets correspondingto the i2-th character row lower boundary according to the i2-thcharacter row lower boundary and the local adjustment reference pointcorresponding to the i2-th character row lower boundary; in response tothat the local character row area corresponding to the i2-th characterrow does not overlap the local character row area corresponding to anyone of remaining character row in the M character rows, determining thelocal adjustment offset corresponding to each pixel in the localcharacter row area corresponding to the i2-th character row according tothe multiple reference character offsets corresponding to the i2-thcharacter row and the retention coefficient group corresponding to thelocal character row area corresponding to the i2-th character row in theM retention coefficient groups, wherein the M local adjustment offsetgroups include a local adjustment offset group corresponding to thei2-th character row, and the local adjustment offset group correspondingto the i2-th character row includes the local adjustment offsetcorresponding to each pixel in the local character row areacorresponding to the i2-th character row.

For example, in the image processing device provided by an embodiment ofthe present disclosure, the operation of determining, by the localadjustment module, the M local adjustment offset groups corresponding tothe M character rows according to the M character row lower boundaries,the local adjustment reference line and the M retention coefficientgroups further includes the following operations: for the i3-thcharacter row lower boundary in the M character row lower boundaries,determining the local adjustment reference point corresponding to thei3-th character row lower boundary in the M local adjustment referencepoints, wherein i3 is a positive integer less than or equal to M, i2 andi3 are not equal to each other; determining the i3-th character rowcorresponding to the i3-th character row lower boundary in the Mcharacter rows; determining the local character row area correspondingto the i3-th character row according to the height of the character rowand the i3-th character row; determining the multiple referencecharacter offsets corresponding to the i3-th character row according tothe i3-th character row lower boundary and the local adjustmentreference point corresponding to the i3-th character row lower boundary;in response to that the local character row area corresponding to thei2-th character row partially overlaps the local character row areacorresponding to the i3-th character row: for the overlapped areabetween the local character row area corresponding to the i2-thcharacter row and the local character row area corresponding to thei3-th character row, determining the local adjustment offset of eachpixel in the overlapped area according to the multiple referencecharacter offsets corresponding to the i2-th character row and themultiple reference character offsets corresponding to the i3-thcharacter row, for each pixel in the non-overlapped area outside theoverlapped area in the local character area corresponding to the i2-thcharacter row, determining the local adjustment offset corresponding toeach pixel in the non-overlapped area of the local character row areacorresponding to the i2-th character row according to the multiplereference character offset corresponding to the i2-th character row andthe retention coefficient group corresponding to the local character rowarea corresponding to the i2-th character row in the M retentioncoefficient groups, wherein the local adjustment offset groupcorresponding to the i2-th character row in the M local adjustmentoffset groups includes the local adjustment offset of each pixel in thenon-overlapped area of the local character row area corresponding to thei2-th character row and the local adjustment offset of each pixel in theoverlapped area; for each pixel in the non-overlapped area outside theoverlapped area in the local character row area corresponding to thei3-th character row, determining the local adjustment offsetcorresponding to each pixel in the non-overlapped area in the localcharacter row area corresponding to the i3-th character row according tothe multiple reference character offsets corresponding to the i3-thcharacter row and the retention coefficient groups corresponding to thelocal character row area corresponding to the i3-th character row in theM retention coefficient groups, wherein the local adjustment offsetgroup corresponding to the i3-th character row in the M local adjustmentoffset groups includes the local adjustment offset of each pixel in thenon-overlapped area corresponding to the local character row areacorresponding to the i3-th character row and the local adjustment offsetof each pixel in the overlapped area.

For example, in an image processing device provided by an embodiment ofthe present disclosure, the operation of performing, by the globalcorrection module, the global correction processing on the input imageto obtain an intermediate corrected image includes the followingoperations: performing the binarization processing on the input image toobtain a binarized image; performing the character connection processingon the binarized image to obtain a second character connected image,wherein the second character connected image includes M second characterconnected areas corresponding to the M character rows; acquiring Mmiddle lines corresponding to the M second character connected areasone-to-one, wherein the M second character connected areas are arrangedalong the first direction; setting W first division lines, wherein the Wfirst division lines extend along the first direction; acquiringmultiple first intersections between the M middle lines and the W firstdivision lines; obtaining W quadratic functions corresponding to the Wfirst division lines one-to-one based on the quadratic fitting performedon the multiple first intersections; setting the Q second divisionlines, wherein the Q second division lines extend along the seconddirection, and the first direction and the second direction areperpendicular to each other; obtaining multiple second intersectionsbetween the W first division lines and the Q second division lines;calculating the global adjustment offset of the multiple secondintersections based on the W quadratic functions; performing the globalcorrection processing on the binarized image according to the globaladjustment offset of the multiple second intersections to obtain theintermediate corrected image.

At least one embodiment of the present disclosure provides an electronicdevice, including: a memory for non-transitory storage ofcomputer-readable instructions; a processor for running thecomputer-readable instructions, wherein the image processing method asdescribed in any embodiment of the present disclosure is implementedwhen the computer-readable instructions are executed by the processor.

At least one embodiment of the present disclosure provides anon-transitory computer readable storage medium, wherein thenon-transitory computer readable storage medium stores computer-readableinstructions, wherein the image processing method as described in anyembodiment of the present disclosure is implemented when thecomputer-readable instructions are executed by the processor.

BRIEF DESCRIPTION OF THE DRAWINGS

In order to explain the technical solutions of the embodiments of thepresent disclosure more clearly, the drawings of the embodiments will bebriefly introduced below. Obviously, the drawings in the followingdescription only relate to some embodiments of the present disclosure,rather than limit the present disclosure.

FIG. 1 is a schematic flowchart of an image processing method providedby at least one embodiment of the present disclosure.

FIG. 2 is a schematic flowchart of step S12 in the image processingmethod shown in FIG. 1.

FIG. 3 is a schematic view of an input image provided by at least oneembodiment of the present disclosure.

FIG. 4A is a schematic view of an intermediate corrected image providedby some embodiments of the present disclosure.

FIG. 4B is a schematic view of a first character connected imageprovided by some embodiments of the present disclosure.

FIG. 4C is a schematic view of an intermediate corrected image includinga plurality of pixels corresponding to a character row lower boundaryprovided by some embodiments of the present disclosure.

FIG. 4D is a schematic view of an intermediate corrected image includinga character row lower boundary provided by some embodiments of thepresent disclosure.

FIG. 4E is a schematic view of an intermediate corrected image includinga local adjustment reference line provided by some embodiments of thepresent disclosure.

FIG. 4F is a schematic view of an overlapped area provided by someembodiments of the present disclosure.

FIG. 5A is a schematic view of a binarized image of an input imageprovided by some embodiments of the present disclosure.

FIG. 5B is a schematic view of a second character connected imageprovided by some embodiments of the present disclosure.

FIG. 6A is a schematic view of an input image showing M middle linesprovided by some embodiments of the present disclosure.

FIG. 6B is a schematic view of an input image showing W first divisionlines provided by some embodiments of the present disclosure.

FIG. 6C is a schematic view of an input image showing Q second divisionlines provided by some embodiments of the present disclosure.

FIG. 7A is a schematic view of a target corrected image provided by someembodiments of the present disclosure.

FIG. 7B is a schematic view showing a global correction and a localcorrection provided by some embodiments of the present disclosure.

FIG. 8 is a schematic block view of an image processing device providedby at least one embodiment of the present disclosure.

FIG. 9 is a schematic block view of an electronic device provided by atleast one embodiment of the present disclosure.

FIG. 10 is a schematic view of a non-transitory computer readablestorage medium provided by at least one embodiment of the presentdisclosure.

DESCRIPTION OF EMBODIMENTS

In order to make the objectives, technical solutions, and advantages ofthe embodiments of the present disclosure clearer, the technicalsolutions of the embodiments of the present disclosure will be describedclearly and thoroughly with reference to the accompanying drawings ofthe embodiments of the present disclosure. Obviously, the describedembodiments are part of the embodiments of the present disclosure,rather than all of the embodiments. Based on the described embodimentsof the present disclosure, all other embodiments obtained by those ofordinary skill in the art without inventive effort fall within theprotection scope of the present disclosure.

Unless otherwise defined, the technical terms or scientific terms usedin the present disclosure shall have the common meanings comprehensibleby those with ordinary skills in the field to which this disclosurebelongs. The “first”, “second” and similar words used in the presentdisclosure do not indicate any order, quantity or importance, but areonly used to distinguish different components. The terms “include” or“comprises” and other similar words mean that the element or itemappearing before the word covers the element or item listed after theword and their equivalents, but does not exclude other elements oritems. Terms such as “connected” or “linked” and similar words are notlimited to physical or mechanical connections, but may includeelectrical connections, regardless direct or indirect. Terms “Up”,“Down”, “Left”, “Right”, etc. are only used to indicate the relativeposition relationship. When the absolute position of the describedobject changes, the relative position relationship may also changeaccordingly.

In order to keep the following description of the embodiments of thepresent disclosure clear and concise, the present disclosure omitsdetailed descriptions of some known functions and known components.

At least one embodiment of the present disclosure provides an imageprocessing method, an image processing device, an electronic device, anda non-transitory computer readable storage medium. The image processingmethod includes: obtaining an input image, wherein the input imageincludes M character rows, each character row in the M character rowsincludes at least one character, and M is a positive integer; performingglobal correction processing on the input image to obtain anintermediate corrected image; performing local adjustment on theintermediate corrected image to obtain a target corrected image. Thestep of performing local adjustment on the intermediate corrected imageto obtain a target corrected image includes: determining the M characterrow lower boundaries corresponding to the M character rows according tothe intermediate corrected image; and determining the local adjustmentreference line and M retention coefficient groups based on theintermediate corrected image and the M character row lower boundaries,wherein each retention coefficient group in the M retention coefficientgroups includes multiple retention coefficients; determining M localadjustment offset groups corresponding to the M character rows accordingto the M character row lower boundaries, the local adjustment referenceline and the M retention coefficient groups, wherein each localadjustment offset group in the M local adjustment offset groups includesmultiple local adjustment offsets; performing local adjustment on the Mcharacter rows in the intermediate corrected image according to the Mlocal adjustment offset groups to obtain the target corrected image.

In the image processing method provided by the embodiment of the presentdisclosure, global correction is performed first on the input image toget an intermediate corrected image, and then local adjustment isperformed on the intermediate corrected image to determine the targetcorrected image. The local adjustment can be performed to make somesupplementary correction directed at some details that are neglected inthe global correction process. In this way, it is possible to avoid thatsome unsmooth areas generated due to the details neglected in the globalcorrection process still exist in some details of the images subjectedto the global correction process, and avoid that the detailed parts arenot corrected. Therefore, local adjustments are required to furtherprocess the images in order to improve the accuracy of the correction.

The image processing method provided by the embodiment of the presentdisclosure may be applied to the image processing device provided by theembodiment of the present disclosure, and the image processing devicemay be configured on an electronic device. The electronic device may bea personal computer, a mobile terminal, etc., and the mobile terminalmay be a hardware device such as a mobile phone or a tablet computer.

The embodiments of the present disclosure will be described in detailbelow with reference to the accompanying drawings, but the presentdisclosure is not limited to these specific embodiments.

FIG. 1 is a schematic flowchart of an image processing method providedby at least one embodiment of the present disclosure. FIG. 2 is aschematic flowchart of step S12 in the image processing method shown inFIG. 1. FIG. 3 is a schematic view of an input image provided by atleast one embodiment of the present disclosure.

As shown in FIG. 1, the image processing method provided by anembodiment of the present disclosure includes steps S10 to S12. First,in step S10, an input image is obtained; in step S11, global correctionprocessing is performed on the input image to get an intermediatecorrected image; in step S12, local adjustment is performed on theintermediate corrected image to get the target corrected image.

For example, in step S10, the input image includes M character rows,each character row in the M character rows includes at least onecharacter, and M is a positive integer. The characters in each characterrow may be arranged along the second direction, the M character rows maybe arranged along the first direction, and the first direction and thesecond direction may be substantially perpendicular to each other. Thesecond direction may be a horizontal direction, and may be a verticaldirection. For example, as shown in FIG. 3, in some embodiments, thefirst direction may be the Y-axis direction, that is, the verticaldirection, and the second direction may be the X-axis direction, thatis, the horizontal direction.

As shown in FIG. 3, M character rows can include the character“Privacy”, the character “Act”, the character “Statement”, the character“The”, the character “1974”, the character “requires”, the character“that”, and the character “you”, etc., wherein the character “Privacy”,the character “Act”, and the character “Statement” are arranged in thesame character row (for example, the first row), and the character“The”, the character “1974”, the character “requires”, the character“that”, and the character “you”, etc. are arranged in the same characterrow (for example, the second row).

For example, each character can be numbers, Chinese characters (Chinesetext, Chinese words, etc.), foreign characters (for example, foreignletters, foreign words, etc.), special characters (for example, percentsign “%”), punctuation marks, and graphics, etc.

For example, the input image is an image obtained by a user taking aphoto of an object, the object includes characters, and the object maybe, for example, business cards, test papers, documents, invoices, andso on. As shown in FIG. 3, in some embodiments, the input image may bean image obtained by photographing a document.

For example, in the input image, each character may be inclined withrespect to the horizontal direction or the vertical direction. As shownin FIG. 3, a coordinate system OXY is determined with the upper leftcorner of the input image as the coordinate origin, the X-axis extendsto the right and the Y-axis extends downwards. For example, thehorizontal direction can be the X-axis direction, and the verticaldirection can be the Y-axis direction. The characters “violation”, “or”,“potential”, “law”, etc. are arranged in a row, and the angle betweenthe character row and the horizontal direction (that is, the X-axisdirection) is 0, that is, the angle at which the character row isinclined with respect to the horizontal direction is 0. It should benoted that in FIG. 3, in order to clearly show the coordinate system,the origin of the coordinate system and the pixel in the upper leftcorner of the input image do not overlap each other. However, thoseskilled in the art should know that the origin of the coordinate systemcan coincide with the pixel in the upper left corner of the input image.The present disclosure is not limited thereto. In other embodiments, theorigin of the coordinate system may also coincide with the pixel at thecenter of the input image.

For example, the shape of the input image can be a rectangle or thelike. The shape and size of the input image can be set by the useraccording to the actual situation.

For example, the input image can be an image taken by a digital cameraor a mobile phone, and the input image can be a grayscale image or acolor image. For example, the input image may be an original imagedirectly captured by an image capturing device, or an image obtained bypreprocessing the original image. For example, in order to prevent thedata quality and data imbalance of the input image from affecting theobject edge detection, before the input image is processed, the imageprocessing method may further include preprocessing the input image. Thestep of preprocessing can eliminate irrelevant information or noiseinformation in the input image, so as to better process the input image.

FIG. 4A is a schematic view of an intermediate corrected image providedby some embodiments of the present disclosure. FIG. 4B is a schematicview of a first character connected image provided by some embodimentsof the present disclosure.

For example, as shown in FIG. 2, in some embodiments, step S12 mayinclude steps S120 to S123.

In the image processing method provided by the embodiment of the presentdisclosure, by performing local adjustment on the intermediate correctedimage that is subjected to global correction, the deformation ofcharacters (for example, text) can be reduced, and the correction effectcan be improved.

For example, as shown in FIG. 2, step S120: the M character row lowerboundaries corresponding to the M character rows is determined accordingto the intermediate corrected image.

For example, step S120 may include: performing character connectionprocessing on the intermediate corrected image to obtain a firstcharacter connected image, wherein the first character connected imageincludes M first character connected areas corresponding to the Mcharacter rows; determining the M character row lower boundariescorresponding to the M character rows according to the M first characterconnected areas and the intermediate corrected image.

For example, as shown in FIG. 4A, in some embodiments, the intermediatecorrected image may be a binarized image. In the intermediate correctedimage, the pixel corresponding to the character is represented by white,and the pixel corresponding to the background is represented by black,that is, the pixel corresponding to the character has a grayscale valueof 255, and the pixel corresponding to the background has a grayscalevalue of 0.

For example, in step S120, when the intermediate corrected image can bea binarized image, the intermediate corrected image can be subjected tocharacter connection processing directly based on mathematicalmorphology operation, so as to obtain a first character connected imageincluding the M first character connected areas. The first characterconnected image shown in FIG. 4B is an image obtained by performingcharacter connection processing on the intermediate corrected imageshown in FIG. 4A.

It should be noted that the present disclosure does not limit that theintermediate corrected image is a binarized image. In other embodiments,the intermediate corrected image may also be a grayscale image or acolor image. Under the circumstances, in step S120, character connectionprocessing is performed on the intermediate corrected image to obtainthe first character connected image, which may include: firstly, theintermediate corrected image is binarized to get a binarized image ofthe intermediate corrected image, and then character connectionprocessing is performed on the binarized image of the intermediatecorrected image to obtain a first character connected image.

For example, as shown in FIG. 4B, the white area is the first characterconnected area. For example, each first character connected area mayinclude multiple characters in the same row, and the M character rowscorrespond to the M first character connected areas one-to-one, that is,each character row only corresponds to one first character connectedarea.

For example, the character connection processing can perform theexpansion operation processing on the intermediate corrected image,thereby connecting the characters spaced apart into a straight line, soas to facilitate the subsequent linear detection.

For example, as shown in FIG. 4B, the M first character connected areasare arranged along the first direction (i.e., the Y-axis direction ofthe coordinate system shown in FIG. 3).

For example, in step S120, based on the M first character connectedareas, the lower boundary of the area corresponding to the M firstcharacter connected areas can be determined. Based on the intermediatecorrected image, the approximate range where each character row islocated can be determined. Based on the approximate range where thelower boundary of area and each character row are located, the characterrow lower boundary corresponding to each character row can bedetermined.

FIG. 4C is a schematic view of an intermediate corrected image includinga plurality of pixels corresponding to a character row lower boundaryprovided by some embodiments of the present disclosure. FIG. 4D is aschematic view of an intermediate corrected image including a characterrow lower boundary provided by some embodiments of the presentdisclosure.

For example, in step S120, in some embodiments, the step of determiningthe M character row lower boundaries corresponding to the M characterrows according to the M first character connected areas and theintermediate corrected image includes: determining the M area lowerboundaries corresponding to the M first character connected areasone-to-one; performing a boundary fitting process on the M characterrows to obtain the M character row lower boundaries according to the Marea lower boundaries and the intermediate corrected image.

For example, the M character rows include the i1-th character row, thei1-th character row corresponds to the first character connected areacorresponding to the lower boundary of the i1-th area in the M arealower boundaries, and it is a positive integer less than or equal to M.

For example, the step of performing boundary fitting processing on thei1-th character row includes: obtaining the multiple pixels of eachcharacter in the i1-th character row that are closest to the lowerboundary of the i1-th area; removing the noise pixels in the multiplepixels to obtain the target pixel; performing linear or quadraticfitting on the target pixel to obtain the character row lower boundarycorresponding to the i1-th character row.

For example, in some embodiments, the step of performing local linear orquadratic fitting on the target pixel to obtain the character row lowerboundary corresponding to the i1 -th character row includes: performinglocal linear or quadratic fitting on the target pixel corresponding toeach character in the i1-th character row respectively to obtain thefitting boundary of each character corresponding to each character inthe i1-th character row; then, performing linear or quadratic fitting onthe fitting boundary of each character to obtain the character row lowerboundary corresponding to the i1-th character row.

For example, in other embodiments, the step of performing local linearor quadratic fitting on the target pixel to obtain the character rowlower boundary corresponding to the i1 -th character row includes:performing linear or quadratic fitting on the entire target pixelcorresponding to each character in the i1-th character row to directlyobtain the character row lower boundary corresponding to the i1-thcharacter row.

It should be noted that linear fitting is not enough for character rowsthat are more curved. Linear fitting and quadratic fitting are setaccording to the density of the pixel point closest to the lowerboundary of the corresponding area in the collected character row. Ifthere are more pixel points closest to the lower boundary of thecorresponding area in the collected character row, the quadratic fittingis performed. If there are less pixel points closest to the lowerboundary of the corresponding area in the collected character row,linear fitting is performed. For example, a density threshold can beset, and if the density of the pixel points exceeds the densitythreshold, the quadratic fitting is performed. The fitting of each pixelpoint is performed by using several local pixel points nearby. Forquadratic fitting, abnormality also needs to be determined. For example,if the coefficient of the quadratic term obtained through the quadraticfitting is too large, the result of the quadratic fitting is discardedand the linear fitting is performed; or the offset of the quadratic lineobtained by the quadratic fitting at the interpolation point issignificantly large as compared to the actual point, the result of thequadratic fitting is also discarded, and linear fitting is performedinstead.

For example, as shown in FIG. 4C, the black dots and short black linesat the bottom of each character row are the pixels of each characterthat are closest to the lower boundary of the area. It should be notedthat the pixel corresponding to the letter in some characters may nothave the pixel closest to the lower boundary of the area. As shown inFIG. 4C, all the pixels corresponding to the letter P and the letter rin the character “Privacy” in the first row are not the pixels closestto the lower boundary of the area.

For example, in step S120, the lower boundary of the area of each firstcharacter connected area represents the boundary of the first characterconnected area away from the X-axis of the coordinate system. Eachcharacter row lower boundary of each character row represents theboundary of the character row away from the X-axis of the coordinatesystem.

For example, the lower boundary of the area may not be a straight linesegment, but may be a line segment with a small wave shape, a zigzagshape, etc.

For example, in some embodiments, the step of acquiring a plurality ofpixels of each character in the i1-th character row closest to the lowerboundary of the i1-th area may include: in the Y-axis direction,acquiring multiple pixels of each character in the i1-th character rowclosest to the lower boundary of the i1-th area, that is, in the Y-axisdirection, obtaining the pixel on the pixel column where any one of thepixels of each character in the i1-th character row is located closestto the lower boundary of the i1-th area.

For example, the step of removing the noise pixels in the multiplepixels to obtain the target pixel may include: removing the noise pixelsin the multiple pixels according to a predetermined rule to obtain thetarget pixel. For example, if the slope of a straight line formed by twoadjacent pixels in a plurality of pixels is greater than the slopethreshold, then the two adjacent pixels are noise pixels. In addition,if the distance between a pixel in the plurality of pixels and the lowerboundary of the i1-th area is greater than the distance threshold, thepixel is also a noise pixel. For example, the predetermined rule mayinclude a slope threshold and a distance threshold, etc., and the slopethreshold and the distance threshold may be set by the user according toactual conditions.

It should be noted that “two adjacent pixels” does not mean that the twopixels are directly adjacent to each other physically, but that the twoadjacent pixels are located in different pixel columns. For example, iftwo adjacent pixels are respectively located in the a-th pixel columnand the a+b-th pixel column, a is a positive integer and b is a positiveinteger. For example, when b is 1, the two adjacent pixels are locatedin two adjacent pixel columns. Under the circumstances, the two adjacentpixels are adjacent to each other physically. When b is not 1, the twoadjacent pixels are not adjacent to each other physically. The twoadjacent pixels may not be in contact with each other physically, orthey may be in contact with each other. This disclosure provides nolimitation thereto. For example, one of the two adjacent pixels islocated in the first row of the a-th pixel column, and the other pixelof the two adjacent pixels is located in the 5-th row of the a+b-thpixel column. Under the circumstances, the two adjacent pixels are notin contact with each other physically. If b is 1, and one of the twoadjacent pixels is located in, for example, the first row of the a-thpixel column, and the other pixel of the two adjacent pixels is locatedin, for example, the first row of the a+b-th pixel column, under thecircumstances, the two adjacent pixels are in contact with each otherphysically.

For example, as shown in FIG. 4D, the line below each character row isthe character row lower boundary corresponding to the character rowobtained by fitting. The character row lower boundary may not be astraight line segment, but may be a line segment having a small waveshape, a zigzag shape, etc. It should be noted that, in order to clearlyshow the character row lower boundary, the intermediate corrected imageshown in FIG. 4D is not embodied in the form of a binarized image.

For example, FIG. 4D shows the character row lower boundary of allcharacter rows in the intermediate corrected image. The character rowlower boundary and the character row corresponding to the character rowlower boundary may not overlap or partially overlap. For example, thecharacter row lower boundary corresponding to the character row (forexample, the first row) where the character “Privacy” is locatedoverlaps some pixels in all pixels representing letter “y” in thecharacter “Privacy”.

For example, lower boundaries of two character rows corresponding to twoadjacent character rows can be separated from each other by a certaindistance. It should be noted that, among lower boundaries of multiplecharacter rows, there may be lower boundaries of character rows that areparallel to each other. The present disclosure provides no limitation tothe parameters of the character row lower boundary, and the length,slope and other parameters of the character row lower boundary can bedetermined based on the character row corresponding to the character rowlower boundary.

FIG. 4E is a schematic view of an intermediate corrected image includinga local adjustment reference line provided by some embodiments of thepresent disclosure.

For example, as shown in FIG. 2, in step S121: Based on the intermediatecorrected image and the M character row lower boundaries, the localadjustment reference line and the M retention coefficient groups aredetermined, wherein each of the M retention coefficient groups includesmultiple retention coefficients.

For example, in step S121, the step of determining the local adjustmentreference line includes: for the i4-th character row in the M characterrows, determining the local character row area corresponding to thei4-th character row, wherein i4 is a positive integer less than or equalto M; for each pixel in the local character row area, obtaining thepoint on the character row lower boundary corresponding to the i4-thcharacter row closest to the pixel as the reference pixel; determiningthe attenuation value corresponding to the pixel according to thedistance between the pixel and the reference pixel; performing the aboveoperations on each pixel in the local character row area correspondingto the i4-th character row to determine the retention coefficientscorresponding to all pixels in the local character row areacorresponding to the i4-th character row, thereby determining theretention coefficient group corresponding to the local character rowarea corresponding to the i4-th character row. For example, the Mretention coefficient groups include the retention coefficient groupscorresponding to local character row area corresponding to the i4-thcharacter row. The above operations are performed on the M characterrows respectively to determine the M retention coefficient groups.

It should be noted that the local character row area is determinedaccording to the row height of its corresponding character row, and acorresponding row height will be calculated for each character row. Thisrow height is obtained by calculating the average of the heights of thecharacter connected areas of the character rows.

It should be noted that the shape of the local character row area is anirregular shape. In the arrangement direction of the character rows, theshape of the upper boundary of the local character row area is the sameas the shape of the lower boundary of the local character row area, andthe upper boundary and the lower boundary of the local character rowarea are parallel to each other. The local character row area willcontain a marginal area outside certain character rows. The localcharacter row area of the character row can be set as an area that isthree rows away from the character row in the upper-lower direction,that is, the height of the local character row area of the character rowis 6 times height. For example, in the arrangement direction ofcharacter rows, the character row lower boundaries corresponding tocharacter rows can be extended up to a distance of 3 rows to determinethe upper boundary of the local character row area corresponding to thecharacter row, and the character row lower boundaries corresponding tocharacter rows can be extended down to a distance of 3 rows to determinethe lower boundary of the local character row area corresponding to thecharacter row, thereby determining the local character row areacorresponding to the character row.

For example, the retention coefficient group corresponding to the localcharacter row area corresponding to the i4-th character row includes theretention coefficient corresponding to all pixels in the local characterrow area corresponding to the i4-th character row.

For example, the pixel and the reference pixel may be located in thesame pixel column, or may be located in different pixel columns, as longas it is ensured that the distance between the pixel and the referencepixel is smaller than the distance between the pixel and any of theremaining pixel on the lower boundary of the corresponding characterrow.

For example, the value range of the retention coefficient in eachretention coefficient group is 0-1.

For example, retention coefficient groups can be embodied in the form ofa matrix. For example, the size of the matrix corresponding to theretention coefficient groups can be larger than the size of the localcharacter row area (pixel matrix) corresponding to the character rowcorresponding to the retention coefficient groups. Each pixel in thelocal character row area corresponds to a retention coefficient in theretention coefficient group.

For example, the range of attenuation value is 0-1. The attenuationvalue of a pixel is proportional to the distance between the pixel andthe corresponding character row lower boundary, and the attenuationvalue is preset according to actual conditions. In general, the closerthe pixel in the local character row area is to the correspondingcharacter row lower boundary, that is, the smaller the distance betweenthe pixel and the reference pixel, the smaller the attenuation valuecorresponding to the pixel (that is, the closer the attenuation value isto 0); the farther the pixel in the local character row area is from thecorresponding character row lower boundary, that is, the greater thedistance between the pixel and the reference pixel, and the greater theattenuation value corresponding to the pixel (that is, the closer theattenuation value is to 1). Generally, the area that is 3 to 5 rows awayis completely attenuated, that is, the attenuation value is 1 under thecircumstances. In specific implementation, each attenuation value isalso related to other factors, including character row height, the ratioof character row height to length and width of input image, the areawhere the characters are located, the ratio of detected referencecharacter offset to the character row height and so on.

For example, retention coefficient =1-attenuation value.

It should be noted that the character row height is a constant and isrelated to the font size of the characters in the input image and thespacing between the character rows.

For example, as shown in FIG. 2, in step S122: The M local adjustmentoffset groups corresponding to the M character rows are determinedaccording to the M character row lower boundaries, the local adjustmentreference line and the M retention coefficient groups, wherein eachlocal adjustment offset group in the M local adjustment offset groupscomprises multiple local adjustment offsets.

For example, in some embodiments, step S122 includes: determining the Mlocal adjustment reference points corresponding to the M character rowlower boundaries according to the local adjustment reference line; forthe i2-th character row lower boundary in the M character row lowerboundaries, determining the local adjustment reference pointcorresponding to the i2-th character row lower boundary in the M localadjustment reference points, wherein i2 is a positive integer less thanor equal to M; determining the i2-th character row corresponding to thei2-th character row lower boundary in the M character rows;

determining the local character row area corresponding to the i2-thcharacter row according to the height of the character rows and thei2-th character row; determining the multiple reference characteroffsets corresponding to the i2-th character row lower boundaryaccording to the i2-th character row lower boundary and the localadjustment reference point corresponding to the i2-th character rowlower boundary; in response to that the local character row areacorresponding to the i2-th character row does not overlap the localcharacter row area corresponding to any one of remaining character rowin the M character rows, determining the local adjustment offsetcorresponding to each pixel in the local character row areacorresponding to the i2-th character row according to the multiplereference character offsets corresponding to the i2-th character row andthe retention coefficient group corresponding to the local character rowarea corresponding to the i2-th character row in the M retentioncoefficient groups, that is, determining the local adjustment offsetgroup corresponding to the i2-th character row. The above operations areperformed on the M character rows, thereby determining the M localadjustment offset groups corresponding to the M character rowsone-to-one.

It should be noted that the local character row area includes thecorresponding character row lower boundary, and each pixel in the localcharacter row area includes the pixel on the corresponding character rowlower boundary, that is, the local adjustment offset corresponding toeach pixel in the local character row area includes the referencecharacter offset of pixels on the character row lower boundary.

For example, according to the height of the character rows, the size ofthe local character row area to be considered for each character row canbe determined. For example, the higher the character rows are, thelarger the local character row area that needs to be considered.

For example, the multiple reference character offsets corresponding tothe i2-th character row lower boundary correspond to all pixels on thei2-th character row lower boundary one-to-one, that is to say, eachpixel on the i2-th character row lower boundary corresponds to onereference character offset.

It should be noted that in the embodiments of the present disclosure,the “reference character offset” of a certain pixel on the character rowlower boundary can represent the difference between the Y-axiscoordinate value of a certain pixel in the coordinate system

OXY and the Y-axis coordinate value of the local adjustment referencepoint corresponding to the character row lower boundary in thecoordinate system OXY.

For example, the local adjustment offset of a pixel may indicate theoffset of the pixel in the Y-axis direction in the coordinate systemOXY.

For example, in step S122, the step of determining the local adjustmentoffset corresponding to each pixel in the local character row areacorresponding to the i2-th character row according to the multiplereference character offsets corresponding to the i2-th character row andthe retention coefficient group corresponding to the local character rowarea corresponding to the i2-th character row in the M retentioncoefficient groups includes: for any pixel in the local character rowarea corresponding to the i2-th character row, obtaining the referencepixel corresponding to any pixel; determining the reference characteroffset corresponding to the reference pixel; obtaining the retentioncoefficient corresponding to said any pixel; multiplying the referencecharacter offset corresponding to the reference pixel by the retentioncoefficient corresponding to said any pixel to determine the localadjustment offset of said any pixel.

For example, the local adjustment offset of the pixel may be the productof the reference character offset of the reference pixel correspondingto the pixel and the retention coefficient corresponding to the pixel.The final effect is that the closer the distance between the pixel andthe character row lower boundary corresponding to the character row towhich the pixel belongs, the larger the local adjustment offsetcorresponding to the pixel is obtained (that is, much closer to thereference character offset of the reference pixel corresponding to thepixel). The farther the distance between the pixel and the character rowlower boundary corresponding to the character row to which the pixelbelongs, the smaller the local adjustment offset corresponding to thepixel is obtained. When the distance between the pixel and the characterrow lower boundary corresponding to the character row corresponding tothe pixel exceeds a certain threshold, the local adjustment offsetcorresponding to the pixel is zero.

The purpose of generating the local adjustment offset of each pixel inthe local character row area corresponding to the character row is: tomake the target corrected image generated after the local adjustmentsmooth locally, thereby achieving the effect of local adjustment, andthe local adjustment will not cause the image to be malformed.

For example, the M local adjustment offset groups include the localadjustment offset group corresponding to the i2-th character row, andthe local adjustment offset group corresponding to the i2-th characterrow includes the local adjustment offset corresponding to each pixel inthe local character row area corresponding to the i2-th character row.

For example, in step S122, the step of determining the M localadjustment reference points corresponding to the M character row lowerboundaries according to the local adjustment reference line includes:for each character row lower boundary in the M character row lowerboundaries, under the condition that there is an intersection betweenthe character row lower boundaries and the local adjustment referenceline, determining the local adjustment reference point corresponding tothe character row lower boundary as the intersection; under thecondition that there is no intersection between the character row lowerboundary and the local adjustment reference line, determining the localadjustment reference point corresponding to the character row lowerboundary as the point on the character row lower boundary closest to thelocal adjustment reference line.

For example, in the intermediate corrected image, some character rowsare shorter, as shown in FIG. 4E, the straight line CR represents thelocal adjustment reference line. Some character rows (the character rowincludes the character “open”, the character “to”, the character“public”, the character “inspection”, the character “or”, the character“an”, the character “issued”, the character “patent”) are shorter, andunder the condition that there is no intersection between the characterrow lower boundary corresponding to the character row and the localadjustment reference line, then the local adjustment reference pointcorresponding to the character row lower boundary corresponding to thecharacter row is the point on the character row lower boundary closestto the local adjustment reference line CR, such as the point Po1 shownin FIG. 4E. Under the condition that there is an intersection betweenthe character row lower boundary corresponding to another character row(the character row includes the character “Privacy”, the character“Act”, and the character “Statement”) and the local adjustment referenceline, for example, point Po2 as shown in FIG. 4E, then the localadjustment reference point corresponding to the character row lowerboundary corresponding to the second character row is the intersectionPo2 between the character row lower boundary and the local adjustmentreference line CR.

FIG. 4F is a schematic view of an overlapped area provided by someembodiments of the present disclosure.

For example, in some embodiments, for two adjacent character rows, whenthe two local character row areas corresponding to the two characterrows overlap each other, since the overlapped area of the two localcharacter row areas belongs to two local character row areas, the localadjustment offset of the pixel in the overlapped area is jointlydetermined by these two character rows. It will suffice as long as thechange of the local adjustment offset is smooth when transitioning fromone character row to another character row. For example, the localadjustment offset of the pixel in the overlapped area is determined bythe reference character offset corresponding to the two character rows.For example, a boundary threshold can be set (generally, the boundarythreshold can be set to 3 rows high).

For example, in an example, as shown in FIG. 4F, for any pixel column inthe overlapped area OV of two adjacent local character row areas Tet1and Tet2, two pixels P01 and P02 in the pixel column located on thelower boundaries Cb1 and C2 of the character rows corresponding to thetwo adjacent local character row areas Tet1 and Tet2 are determined.

If the distance between the two pixels P01 and P02 is less than or equalto the boundary threshold, in this case, the middle local area (middlelocal pixel) between the two pixels P01 and P02 not only belongs to thelower (upper) local character row area but also belongs to the upper(lower) local character row area. Under the circumstances, there is nonon-overlapped area (pixel) between the two pixels P01 and P02, andtherefore the middle local pixel between the two pixels P01 and P02 canbe obtained by performing linear interpolation on the local adjustmentoffset (i.e., reference character offset) corresponding to the twopixels P01 and P02.

As shown in FIG. 4F, if the distance between the two pixels P01 and P02is greater than the boundary threshold, then for any middle local pixelP1 between the two pixels P01 and P02, the first distance 11 and thesecond distance 12 between said any middle local pixel P1 and the upperand lower boundaries of the overlapped area Ov are determined. Based onthe position of said any middle local pixel P1 in the first localcharacter row area Tet1 in the two adjacent local character row areasTet1 and Tet2, the reference pixel in the first local character row areaTet1 corresponding to said any middle local pixel P1 is determined (forexample, the reference pixel is located in the character row lowerboundary Cb1 corresponding to the first local character row area Teti),and the reference character offset corresponding to the reference pixelcorresponding to said any middle local pixel P1 in the first localcharacter row area Tet1 is determined, and the first retentioncoefficient corresponding to said any middle local pixel P1 is obtained.Based on the first distance 11, the second distance 12, the referencecharacter offset corresponding to the reference pixel corresponding tosaid any middle local pixel P1 in the first local character row areaTet1 and the first retention coefficient, the first local adjustmentoffset of said any middle local pixel P1 is determined. Based on theposition of said any middle local pixel P1 in the second local characterrow area Tet2 in the two adjacent local character row areas Tet1 andTet2, the reference pixel corresponding to said any middle local pixelP1 in the second local character row area Tet2 is determined (forexample, the reference pixel is located in the character row lowerboundary Cb2 corresponding to the second local character row area Tet2).The reference character offset corresponding to the reference pixelcorresponding to said any middle local pixel P1 in the second localcharacter row area Tet2 is determined. The second retention coefficientcorresponding to said any middle local pixel P1 is obtained. Based onthe first distance 11, the second distance 12, the reference characteroffset corresponding to the reference pixel corresponding to said anymiddle local pixel P1 in the second local character row area Tet2 andthe second retention coefficient corresponding to said any middle localpixel P1, the second local adjustment offset of said any middle localpixel P1 is determined. Then, the final local adjustment offset of saidany middle local pixel P1 is determined according to the first localadjustment offset and the second local adjustment offset. For example,the final local adjustment offset can be calculated by using thefollowing formula:

${dy} = {{\frac{12}{{11} + {12}}*dy1*d1} + {\frac{11}{{11} + {12}}*dy2*d2}}$

In the formula, dy represents the final local adjustment offset of saidany middle local pixel P1,

$\frac{12}{{11} + {12}}*dy1*d1$

represents the first local adjustment offset,

$\frac{11}{{11} + {12}}*dy2*d2$

represents the second local adjustment offset, 11 represents the firstdistance, 12 represents the second distance, and dl represents the firstretention coefficient corresponding to said any middle local pixel P1,d2 represents the second retention coefficient corresponding to said anymiddle local pixel P1, dy1 represents the reference character offsetcorresponding to the reference pixel corresponding to said any middlelocal pixel P1 in the first local character row area Tet1, and dy2represent the reference character offset corresponding to the referencepixel corresponding to said any middle local pixel P1 in the secondlocal character row area Tet2. It should be noted that the firstdistance 11 can represent the distance between said any middle localpixel P1 and the upper boundary of the overlapped area Ov, and thesecond distance 12 can represent the lower boundary between said anymiddle local pixel P1 and the overlapped area Ov.

For example, step S122 further includes: for the i3-th character rowlower boundary in the M character row lower boundaries, determining thelocal adjustment reference point corresponding to the i3-th characterrow lower boundary in the M local adjustment reference points, whereini3 is a positive integer less than or equal to M, i2 and i3 are notequal to each other; determining the i3-th character row correspondingto the i3-th character row lower boundary in the M character rows;determining the local character row area corresponding to the i3-thcharacter row according to the height of the character row and the i3-thcharacter row; determining the multiple reference character offsetscorresponding to the i3-th character row according to the i3-thcharacter row lower boundary and the local adjustment reference pointcorresponding to the i3-th character row lower boundary; in response tothat the local character row area corresponding to the i2-th characterrow partially overlaps the local character row area corresponding to thei3-th character row: for the overlapped area between the local characterrow area corresponding to the i2-th character row and the localcharacter row area corresponding to the i3-th character row, determiningthe local adjustment offset of each pixel in the overlapped areaaccording to the multiple reference character offsets corresponding tothe i2-th character row and the multiple reference character offsetscorresponding to the i3-th character row, for each pixel in thenon-overlapped area outside the overlapped area in the local characterarea corresponding to the i2-th character row, determining the localadjustment offset corresponding to each pixel in the non-overlapped areaof the local character row area corresponding to the i2-th character rowaccording to the multiple reference character offsets corresponding tothe i2-th character row and the retention coefficient groupcorresponding to the local character row area corresponding to the i2-thcharacter row in the M retention coefficient groups; for each pixel inthe non-overlapped area outside the overlapped area in the localcharacter row area corresponding to the i3-th character row, determiningthe local adjustment offset corresponding to each pixel in thenon-overlapped area in the local character row area corresponding to thei3-th character row according to the multiple reference characteroffsets corresponding to the i3-th character row and the retentioncoefficient groups in the M retention coefficient groups correspondingto the local character row area corresponding to the i3-th characterrow.

For example, the M local adjustment offset groups and the localadjustment offset group corresponding to the i2-th character row includethe local adjustment offset of each pixel in the non-overlapped area ofthe local character row area corresponding to the i2-th character rowand the local adjustment offset of each pixel in the overlapped area.The local adjustment offset group in the M local adjustment offsetgroups corresponding to the i3-th character row includes the localadjustment offset of each pixel in the non-overlapped area of the localcharacter row area corresponding to the i3-th character row and thelocal adjustment offset of each pixel in the overlapped area.

For example, in some embodiments, the i2-th character row and the i3-thcharacter row are two adjacent character rows, for example, i2=1+i3, ori3=1+i2.

It should be noted that, in some embodiments, the local adjustmentoffset of each pixel in the overlapped area may be the same. Since theoverlapped area generally corresponds to the background part of theinput image, that is, excluding characters, the identical localadjustment offset of each pixel in the overlapped area will not affectthe effect of local adjustment performed on the characters.

For example, as shown in FIG. 2, step S123 includes: performing localadjustment on the M character rows in the intermediate corrected imageaccording to the M local adjustment offset groups to obtain the targetcorrected image.

For example, in some embodiments, step S123 includes: determining thelocal character row area corresponding to M character rows in theintermediate corrected image; and performing linear local adjustment onthe pixels in the local character row area corresponding to the Mcharacter rows respectively according to the M local adjustment offsetgroups to obtain the target corrected image.

It should be noted that the number and types of characters in the inputimage, the characters in the intermediate corrected image, and thecharacters in the target corrected image are the same. The differencebetween them is: there may be differences in the absolute positions ofthe characters in the input image, the characters in the intermediatecorrected image, and the characters in the target corrected image.However, the relative position of each character can remain unchanged,that is, two characters that are adjacent to each other in the inputimage are still adjacent to each other in the intermediate correctedimage and the target corrected image.

For example, global correction is used to correct the overall shape ofall characters in the input image. In some embodiments, globalcorrection can be implemented by using algorithms in opencv based on theconcept of Leptonica (Leptonica is an open source image processing andimage analysis library). In other embodiments, global correction canalso be implemented through machine learning (for example, neuralnetwork).

FIG. 5A is a schematic view of a binarized image of an input imageprovided by some embodiments of the present disclosure. FIG. 5B is aschematic view of a second character connected image provided by someembodiments of the present disclosure. FIG. 6A is a schematic view of aninput image showing M middle lines provided by some embodiments of thepresent disclosure. FIG. 6B is a schematic view of an input imageshowing W first division lines provided by some embodiments of thepresent disclosure. FIG. 6C is a schematic view of an input imageshowing Q second division lines provided by some embodiments of thepresent disclosure.

For example, in some embodiments, step Sll may include: performingbinarization processing on the input image to obtain a binarized imageof the input image; performing character connection processing on thebinarized image to obtain the second character connected image, whereinthe second character connected image includes M second characterconnected areas corresponding to M character rows; obtaining M middlelines corresponding to the M second character connected areasone-to-one, wherein the M second character connected areas are arrangedalong the first direction; setting W first division lines; obtainingmultiple first intersections between the M middle lines and W firstdivision lines; performing quadratic fitting based on the multiple firstintersections to obtain W quadratic functions corresponding to the Wfirst division lines one-to-one; setting Q second division lines;obtaining multiple second intersections between the W first divisionlines and the Q second division lines; calculating the global adjustmentoffset of the multiple second intersections based on the W quadraticfunctions; performing global correction processing on the binarizedimage according to the global adjustment offset of the multiple secondintersections, so as to get the intermediate corrected image.

For example, the binarization process is to set the gray value of thepixel on the input image to 0 or 255, that is, to present the entireinput image with a clear black and white effect. In step S120, thebinarization process is reversed binarization processing, as shown inFIG. 5A, in the binarized image of the input image, the gray value ofthe pixel corresponding to the character is 255, and the gray value ofthe pixel corresponding to the background is 0, that is, the characteris white, and the background is black.

For example, the method of binarization may include threshold method,bimodal method, P-parameter method, big law (OTSU method), maximumentropy method, iterative algorithm, and so on.

For example, the method of performing character connection processing ona binarized image is the same as the method of performing characterconnection processing on an intermediate corrected image describedabove, and no further description will be incorporated herein. Forexample, the second character connected image shown in FIG. 5B is animage obtained by performing character connection processing on theinput image shown in FIG. 5A.

For example, in step S11, the step of performing quadratic fitting basedon a plurality of first intersections to obtain W quadratic functionscorresponding to the W first division lines one-to-one includes:determining the coordinate system based on the input image; determiningthe coordinate values of the multiple character center pointscorresponding to the multiple first intersections in the coordinatesystem; calculating the global adjustment offset of the multiple firstintersections based on the multiple character center points; performingquadratic fitting on the global adjustment offset of the multiple firstintersections to obtain W quadratic functions corresponding to the Wfirst division lines one-to-one.

For example, the coordinate system may be the coordinate system OXYshown in FIG. 3.

For example, in some embodiments, W may be 30, and Q may also be 30.

For example, the W first division lines extend in the first direction,the Q second division lines extend in the second direction, and thefirst direction and the second direction are perpendicular to eachother. For example, the coordinate system includes an X-axis and aY-axis, the first direction may be parallel to the X-axis of thecoordinate system, and the second direction may be parallel to theY-axis of the coordinate system. For example, as shown in FIG. 6A, LCrepresents the middle line corresponding to the second characterconnected area. FIG. 6B shows four first division lines LW1˜LW4, andFIG. 6C shows five second division lines LQ1˜LQ5.

For example, as shown in FIG. 6B, each first division line intersects atleast one of the M middle lines LC, so that a plurality of firstintersections corresponding to the first division lines are determined.It should be noted that because some of the middle lines are short, thefirst division lines do not necessarily intersect with the M middlelines LC. For example, the first division lines LW4 on the rightmostside shown in FIG. 6B do not intersect the middle line corresponding tothe second character connected area (the second character connected areaincludes the characters “The”, “information”, “provided”, “by”, “you”,“in”, “this”, “form”, “will” etc.) located in the tenth row.

For example, the M middle lines LC may be straight lines or curvedlines.

For example, for each first intersection among the plurality of firstintersections, the deviation of each first intersection in the Y-axisdirection is calculated and serves as the global adjustment offset ofthe first intersection. That is, the global adjustment offset of thefirst intersection includes the difference between the Y-axis coordinatevalue of the first intersection in the coordinate system and the Y-axiscoordinate value of the character center point corresponding to thefirst intersection in the coordinate system (difference is the Y-axiscoordinate value of the first intersection in the coordinate systemminus the Y-axis coordinate value of the character center pointcorresponding to the first intersection in the coordinate system). Forexample, the character center point represents the center point of thecharacter row where the first intersection is located.

For example, each second division line intersects with W first divisionlines, thereby determining a plurality of second intersectionscorresponding to the second division lines. As shown in FIG. 6C, eachsecond division line intersects with four first division lines LW1˜LW4.For each second intersection among the plurality of secondintersections, the global adjustment offset of the second intersectionincludes the offset of the second intersection in the Y-axis directionin the coordinate system.

For example, based on W quadratic functions, the step of calculating theglobal adjustment offset of multiple second intersections includes:calculating the global adjustment offset of the multiple secondintersections between the first division lines and the Q second divisionlines according to the quadratic function corresponding to the firstdivision lines. For example, as shown in FIG. 6B and FIG. 6C, based onthe quadratic function corresponding to the first division lines LW1,the global adjustment offset of the five intersections between the firstdivision lines LW1 and the five second division lines LQ1˜LQ5 can becalculated.

For example, if multiple second intersections are arranged as anintersection matrix of W*Q, a grid formed by a group of multiple secondintersections is obtained. For example, when W and Q are both 30, thegrid is a grid composed of 900 (30*30) second intersections.

For example, in some embodiments, the step of performing globalcorrection processing on the input image to get an intermediatecorrected image according to the global adjustment offset of themultiple second intersections includes: performing quadratic fitting onthe global adjustment offset of the multiple second intersections toobtain the global displacement adjustment function; obtaining the globaladjustment offset of each pixel in the input image according to theglobal displacement adjustment function; performing global correctionprocessing on the input image based on the image interpolation algorithmaccording to the global adjustment offset of each pixel in the inputimage, thereby obtaining the intermediate corrected image.

For example, the image interpolation algorithms includenearest-neighbor, bilinear, bicubic and other algorithms.

For example, in some embodiments, the step of performing globalcorrection processing on the binarized image to get an intermediatecorrected image includes: performing global correction processing on thebinarized image to obtain the binarized intermediate corrected image.The binarized intermediate corrected image is the final intermediatecorrected image. In other embodiments, the step of performing globalcorrection processing on the binarized image to get an intermediatecorrected image includes: performing global correction processing on thebinarized image first to obtain the binarized intermediate correctedimage. Then, performing processing on the binarized intermediatecorrected image to obtain the final intermediate corrected image. Thefinal intermediate corrected image is a grayscale image or a colorimage.

FIG. 7A is a schematic view of a target corrected image provided by someembodiments of the present disclosure.

For example, the target corrected image shown in FIG. 7A is an imageobtained by sequentially performing global correction and localcorrection on the input image shown in FIG. 3. As shown in FIG. 7A,after processing the input image according to the processing methodprovided by the embodiment of the present disclosure, the characters inthe character row are arranged in a row along the horizontal direction,and the character row lower boundary corresponding to the character rowis substantially a straight line, and the straight line is substantiallyparallel to the horizontal direction.

For example, as shown in FIG. 7B, the first curve CR1 can represent thedeviation of a character row; the second curve CR2 can represent thedeviation captured by the global correction; the third curve CR3 canrepresent the result of the global correction. After the globalcorrection, there are still details that have not been adjusted. Thethird curve CR3 can represent the details neglected in the globalcorrection; the fourth curve CR4 can represent the result of the globalcorrection plus the local correction.

At least one embodiment of the present disclosure further provides animage processing device. FIG. 8 is a schematic block view of an imageprocessing device provided by at least one embodiment of the presentdisclosure.

For example, as shown in FIG. 8, the image processing device 800includes an acquisition module 801, a global correction module 802, anda local adjustment module 803.

For example, the acquisition module 801 is used for obtaining an inputimage. The input image includes M character rows, each character row inthe M character rows includes at least one character, and M is apositive integer.

The global correction module 802 is configured to perform globalcorrection processing on the input image to get an intermediatecorrected image.

The local adjustment module 803 is configured to make local adjustmenton the intermediate corrected image to get the target corrected image.

For example, in some embodiments, when performing the local adjustmenton the intermediate corrected image by the local adjustment module 803to obtain the target corrected image, the local adjustment module 803performs the following operations: determining the M character row lowerboundaries corresponding to the M character rows according to theintermediate corrected image; determining the local adjustment referenceline and M retention coefficient groups based on the intermediatecorrected image and the M character row lower boundaries, wherein eachretention coefficient group in the M retention coefficient groupsincludes multiple retention coefficients; determining M local adjustmentoffset groups corresponding to the M character rows according to the Mcharacter row lower boundaries, the local adjustment reference line andthe M retention coefficient groups, wherein each local adjustment offsetgroup in the M local adjustment offset groups includes multiple localadjustment offsets; performing local adjustment on the M character rowsin the intermediate corrected image according to the M local adjustmentoffset groups to obtain the target corrected image.

For example, in some embodiments, the step of determining the Mcharacter row lower boundaries corresponding to the M character rows bythe local adjustment module 803 according to the intermediate correctedimage includes the following operations: performing character connectionprocessing on the intermediate corrected image to obtain a firstcharacter connected image, wherein the first character connected imageincludes M first character connected areas corresponding to the Mcharacter rows; and determining the M character row lower boundariescorresponding to the M character rows according to the M first characterconnected areas and the intermediate corrected image.

For example, in some embodiments, the step of determining the Mcharacter row lower boundaries corresponding to the M character rows bythe local adjustment module 803 according to the M first characterconnected areas and the intermediate corrected image includes thefollowing operations: determining the M area lower boundariescorresponding to the M first character connected areas one-to-one;performing boundary fitting processing on the M character rows to obtainthe M character row lower boundaries according to the M area lowerboundaries and the intermediate corrected image.

For example, the M character rows include the i1-th character row, thei1-th character row corresponds to the first character connected areawhich corresponds to the lower boundary of the i1-th area in the M arealower boundaries, it is a positive integer less than or equal to M. Thestep of performing the boundary fitting process on the i1-th characterrow includes: obtaining multiple pixels of each character in the i1-thcharacter row closest to the lower boundary of the i1-th area; removingthe noise pixel in the multiple pixels to obtain the target pixel;performing linear or quadratic fitting on the target pixel to obtain thecharacter row lower boundary corresponding to the i1-th character row.

For example, in some embodiments, the step of determining the M localadjustment offset groups corresponding to the M character rows by thelocal adjustment module 803 according to the M character row lowerboundaries, the local adjustment reference line and the M retentioncoefficient groups includes the following operations: determining the Mlocal adjustment reference points corresponding to the M character rowlower boundaries according to the local adjustment reference line; forthe i2-th character row lower boundary in the M character row lowerboundaries, determining the local adjustment reference pointcorresponding to the i2-th character row lower boundary in the M localadjustment reference points, wherein i2 is a positive integer less thanor equal to M; determining the i2-th character row corresponding to thei2-th character row lower boundary in the M character rows; determiningthe local character row area corresponding to the i2-th character rowaccording to the height of the character rows and the i2-th characterrow; determining the multiple reference character offsets correspondingto the i2-th character row lower boundary according to the i2-thcharacter row lower boundary and the local adjustment reference pointcorresponding to the i2-th character row lower boundary; in response tothat the local character row area corresponding to the i2-th characterrow does not overlap the local character row area corresponding to anyone of remaining character row in the M character rows, determining thelocal adjustment offset corresponding to each pixel in the localcharacter row area corresponding to the i2-th character row according tothe multiple reference character offsets corresponding to the i2-thcharacter row and the retention coefficient group corresponding to thelocal character row area corresponding to the i2-th character row in theM retention coefficient groups, wherein the M local adjustment offsetgroups include a local adjustment offset group corresponding to thei2-th character row, and the local adjustment offset group correspondingto the i2-th character row includes the local adjustment offsetcorresponding to each pixel in the local character row areacorresponding to the i2-th character row.

For example, in some embodiments, the step of determining the M localadjustment offset groups corresponding to the M character rows by thelocal adjustment module 803 according to the M character row lowerboundaries, the local adjustment reference line and the M retentioncoefficient groups further includes the following operations: for thei3-th character row lower boundary in the M character row lowerboundaries, determining the local adjustment reference pointcorresponding to the i3-th character row lower boundary in the M localadjustment reference points, wherein i3 is a positive integer less thanor equal to M, i2 and i3 are not equal to each other; determining thei3-th character row corresponding to the i3-th character row lowerboundary in the M character rows; determining the local character rowarea corresponding to the i3-th character row according to the height ofthe character row and the i3-th character row; determining the multiplereference character offsets corresponding to the i3-th character rowaccording to the i3-th character row lower boundary and the localadjustment reference point corresponding to the i3-th character rowlower boundary; in response to that the local character row areacorresponding to the i2-th character row partially overlaps the localcharacter row area corresponding to the i3-th character row: for theoverlapped area between the local character row area corresponding tothe i2-th character row and the local character row area correspondingto the i3-th character row, determining the local adjustment offset ofeach pixel in the overlapped area according to the multiple referencecharacter offsets corresponding to the i2-th character row and themultiple reference character offsets corresponding to the i3-thcharacter row, for each pixel in the non-overlapped area outside theoverlapped area in the local character area corresponding to the i2-thcharacter row, determining the local adjustment offset corresponding toeach pixel in the non-overlapped area of the local character row areacorresponding to the i2-th character row according to the multiplereference character offsets corresponding to the i2-th character row andthe retention coefficient group corresponding to the local character rowarea corresponding to the i2-th character row in the M retentioncoefficient groups, wherein the M local adjustment offset groups and thelocal adjustment offset group corresponding to the i2-th character rowinclude the local adjustment offset of each pixel in the non-overlappedarea of the local character row area corresponding to the i2-thcharacter row and the local adjustment offset of each pixel in theoverlapped area; for each pixel in the non-overlapped area outside theoverlapped area in the local character row area corresponding to thei3-th character row, determining the local adjustment offsetcorresponding to each pixel in the non-overlapped area in the localcharacter row area corresponding to the i3-th character row according tothe multiple reference character offsets corresponding to the i3-thcharacter row and the retention coefficient group in the M retentioncoefficient groups corresponding to the local character row areacorresponding to the i3-th character row, wherein the local adjustmentoffset group in the M local adjustment offset groups corresponding tothe i3-th character row includes the local adjustment offset of eachpixel in the non-overlapped area of the local character row areacorresponding to the i3-th character row and the local adjustment offsetof each pixel in the overlapped area.

For example, in some embodiments, the step of performing globalcorrection processing on the input image by the global correction module802 to obtain an intermediate corrected image includes the followingoperations: performing binarization processing on the input image toobtain a binarized image; performing character connection processing onthe binarized image to obtain a second character connected image,wherein the second character connected image includes M second characterconnected areas corresponding to the M character rows; acquiring Mmiddle lines corresponding to the M second character connected areasone-to-one, wherein the M second character connected areas are arrangedalong the first direction; setting W first division lines, wherein the Wfirst division lines extend along the first direction; acquiringmultiple first intersections between the M middle lines and the W firstdivision lines; obtaining W quadratic functions corresponding to the Wfirst division lines one-to-one based on the quadratic fitting performedon the multiple first intersections; setting the Q second divisionlines, wherein the Q second division lines extend along the seconddirection, and the first direction and the second direction areperpendicular to each other; obtaining multiple second intersectionsbetween the W first division lines and the Q second division lines;calculating the global adjustment offset of the multiple secondintersections based on the W quadratic functions; performing globalcorrection processing on the binarized image according to the globaladjustment offset of the multiple second intersections to obtain theintermediate corrected image.

For example, the acquisition module 801, the global calibration module802, and/or the local adjustment module 803 include codes and programsstored in memory. The processor can execute the codes and programs torealize some or all of the functions of the acquisition module 801, theglobal correction module 802 and/or the local adjustment module 803described above. For example, the acquisition module 801, the globalcorrection module 802, and/or the local adjustment module 803 may bespecial hardware devices to implement some or all of the functions ofthe acquisition module 801, the global correction module 802, and/or thelocal adjustment module 803 described above. For example, theacquisition module 801, the global correction module 802, and/or thelocal adjustment module 803 may be one circuit board or a combination ofmultiple circuit boards to implement the above-mentioned functions. Inthe embodiment of the present disclosure, the one circuit board or thecombination of multiple circuit boards may include: (1) one or moreprocessors; (2) one or more non-transitory memories connected to theprocessors; and (3) the firmware stored in the memory executable by theprocessor.

It should be noted that the acquisition module 801 is configured toimplement the step S10 shown in FIG. 1, the global correction module 802is configured to implement the step Sll shown in FIG. 1, and the localadjustment module 803 is configured to implement the step S12 shown inFIG. 1. Therefore, for the specific description of the functionsimplemented by the acquisition module 801, please refer to the relateddescription of step S10 shown in FIG. 1 in the embodiment of the imageprocessing method, and for the specific description of the functionsimplemented by the global correction module 802, please refer to therelated description of step Si 1 shown in FIG. 1 in the embodiment ofthe image processing method, for the specific description of thefunctions implemented by the local adjustment module 803, please referto the related description of step S12 shown in FIG. 1 in the embodimentof the image processing method. In addition, the image processing devicecan achieve similar technical effects as the aforementioned imageprocessing method, and no further description is incorporated herein.

At least one embodiment of the present disclosure further provides anelectronic device. FIG. 9 is a schematic block view of an electronicdevice provided by at least one embodiment of the present disclosure.

For example, as shown in FIG. 9, the electronic device includes aprocessor 901, a communication interface 902, a memory 903, and acommunication bus 904. The processor 901, the communication interface902, and the memory 903 communicate with each other through thecommunication bus 904, and the processor 901, the communicationinterface 902, the memory 903 and other components can also communicatethrough a network connection. The present disclosure provides nolimitation to the types and functions of the network here.

For example, the memory 903 is configured for non-transitory storage ofcomputer-readable instructions. The processor 901 is configured toimplement the image processing method described in any one of theforegoing embodiments when executing computer-readable instructions. Forthe specific implementation of each step of the image processing methodand related description, please refer to the above-mentioned embodimentof the image processing method, and no further description isincorporated herein.

For example, other implementations of the image processing methodimplemented by the processor 901 by executing the program stored in thememory 903 are the same as the implementations mentioned in theforegoing embodiments of the image processing method, and no furtherdescription is incorporated herein.

For example, the communication bus 904 may be a peripheral componentinterconnection standard (PCI) bus or an extended industry standardarchitecture (EISA) bus. The communication bus can be classified intoaddress bus, data bus, control bus, etc. For ease of illustration, thecommunication bus is only represented by a thick line in the drawing,but it does not mean that there is only one busbar or one type ofbusbar.

For example, the communication interface 902 is configured to implementcommunication between the electronic device and other devices.

For example, the processor 901 and the memory 903 may be provided on theserver terminal (or the cloud).

For example, the processor 901 may control other components in theelectronic device to perform desired functions. The processor 901 can bea central processing unit (CPU), a network processor (NP), etc., and canalso be a digital signal processor (DSP), an application-specificintegrated circuit (ASIC), a field programmable gate array (FPGA) orother programmable logic devices, discrete gates or transistor logicdevices, discrete hardware components. The central processing unit (CPU)can be X86 or ARM architecture, etc.

For example, the memory 903 may include one or any combination ofmultiple computer program products, and the computer program productsmay include various forms of computer readable storage medium, such asvolatile memory and/or non-volatile memory. Volatile memory may include,for example, random access memory (RAM) and/or cache memory (CACHE) andso on. Non-volatile memory may include, for example, read-only memory(ROM), hard disk, erasable programmable read-only memory (EPROM),portable compact disk read-only memory (CD-ROM), USB memory, flashdrive, etc. One or more computer-readable instructions may be stored onthe computer readable storage medium, and the processor 901 may run thecomputer-readable instructions to implement various functions of theelectronic device. Various applications and various data can also bestored in the storage medium.

For example, for a detailed description of the process of performingimage processing by the electronic device, reference may be made to therelevant description in the embodiment of the image processing method,and no further description is incorporated herein.

FIG. 10 is a schematic view of a non-transitory computer readablestorage medium provided by at least one embodiment of the presentdisclosure. For example, as shown in FIG. 10, one or morecomputer-readable instructions 1001 may be stored non-temporarily on thestorage medium 1000. For example, when the computer-readableinstructions 1001 are executed by a processor, one or more steps in theimage processing method described above can be executed.

For example, the storage medium 1000 may be applied to theabove-mentioned electronic device, for example, the storage medium 1000may include the memory 903 in the electronic device.

For example, for the description of the storage medium 1000, pleaserefer to the description of the memory in the embodiment of theelectronic device, and no further description is incorporated herein.

For this disclosure, the following needs to be specified:

(1) The drawings of the embodiments of the present disclosure only referto the structures related to the embodiments of the present disclosure,and other structures can refer to the common design.

(2) For clarity, in the drawings used to describe the embodiments of thepresent invention, the thickness and size of layers or structures areexaggerated. It can be understood that when an element such as a layer,film, region or substrate is referred to as being “on” or “under”another element, the element can be “directly” “on” or “under” anotherelement, or an intermediate element may be located therebetween.

(3) As long as no conflict is generated, the embodiments of the presentdisclosure and the features in the embodiments can be combined with eachother to obtain new embodiments.

The above are only specific implementations of the present disclosure,but the protection scope of the present disclosure is not limitedthereto, and the protection scope of the present disclosure should besubject to the protection scope of the claims.

What is claimed is:
 1. An image processing method, comprising: obtainingan input image, wherein the input image comprises M character rows, andeach of the M character rows comprises at least one character, and M isa positive integer; performing a global correction processing on theinput image to obtain an intermediate corrected image; and performing alocal adjustment on the intermediate corrected image to obtain a targetcorrected image, wherein the step of performing the local adjustment onthe intermediate corrected image to obtain the target corrected imagecomprises: determining M character row lower boundaries corresponding tothe M character rows according to the intermediate corrected image;determining a local adjustment reference line and M retentioncoefficient groups based on the intermediate corrected image and the Mcharacter row lower boundaries, wherein each of the M retentioncoefficient groups comprises multiple retention coefficients;determining M local adjustment offset groups corresponding to the Mcharacter rows according to the M character row lower boundaries, thelocal adjustment reference line and the M retention coefficient groups,wherein each of the M local adjustment offset groups comprises multiplelocal adjustment offsets; and performing the local adjustment on the Mcharacter rows in the intermediate corrected image according to the Mlocal adjustment offset groups to obtain the target corrected image. 2.The image processing method according to claim 1, wherein the step ofdetermining the M character row lower boundaries corresponding to the Mcharacter rows according to the intermediate corrected image comprises:performing a character connection processing on the intermediatecorrected image to obtain a first character connected image, wherein thefirst character connected image comprises M first character connectedareas corresponding to the M character rows; and determining the Mcharacter row lower boundaries corresponding to the M character rowsaccording to the M first character connected areas and the intermediatecorrected image.
 3. The image processing method according to claim 2,wherein the step of determining the M character row lower boundariescorresponding to the M character rows according to the M first characterconnected areas and the intermediate corrected image comprises:determining M area lower boundaries corresponding to the M firstcharacter connected areas one-to-one; and performing a boundary fittingprocessing on the M character rows to obtain the M character row lowerboundaries according to the M area lower boundaries and the intermediatecorrected image, wherein the M character rows comprise an i1-thcharacter row, the i1-th character row corresponds to the firstcharacter connected area which corresponds to a lower boundary of theit-th area in the M area lower boundaries, it is a positive integer lessthan or equal to M, the step of performing the boundary fitting processon the i1-th character row comprises: obtaining at least one pixel ofeach of the at least one character in the i1-th character row closest tothe lower boundary of the i1-th area; removing a noise pixel in the atleast one pixel to obtain a target pixel; and performing a linear orquadratic fitting on the target pixel to obtain the character row lowerboundary corresponding to the i1-th character row.
 4. The imageprocessing method according to claim 1, wherein the step of determiningthe M local adjustment offset groups corresponding to the M characterrows according to the M character row lower boundaries, the localadjustment reference line and the M retention coefficient groupscomprises: determining M local adjustment reference points correspondingto the M character row lower boundaries according to the localadjustment reference line; for an i2-th character row lower boundary inthe M character row lower boundaries, determining a local adjustmentreference point corresponding to the i2-th character row lower boundaryin the M local adjustment reference points, wherein i2 is a positiveinteger less than or equal to M; determining an i2-th character rowcorresponding to the i2-th character row lower boundary in the Mcharacter rows; determining a local character row area corresponding tothe i2-th character row according to a height of the character row andthe i2-th character row; determining multiple reference characteroffsets corresponding to the i2-th character row lower boundaryaccording to the i2-th character row lower boundary and the localadjustment reference point corresponding to the i2-th character rowlower boundary; and in response to that the local character row areacorresponding to the i2-th character row does not overlap a localcharacter row area corresponding to any one of remaining character rowin the M character rows, determining the local adjustment offsetcorresponding to each of pixels in the local character row areacorresponding to the i2-th character row according to the multiplereference character offsets corresponding to the i2-th character row andthe retention coefficient group corresponding to the local character rowarea corresponding to the i2-th character row in the M retentioncoefficient groups, wherein the M local adjustment offset groupscomprise a local adjustment offset group corresponding to the i2-thcharacter row, and the local adjustment offset group corresponding tothe i2-th character row comprises the local adjustment offsetcorresponding to each of the pixels in the local character row areacorresponding to the i2-th character row.
 5. The image processing methodaccording to claim 4, wherein the step of determining the M localadjustment offset groups corresponding to the M character rows accordingto the M character row lower boundaries, the local adjustment referenceline and the M retention coefficient groups further comprises: for ani3-th character row lower boundary in the M character row lowerboundaries, determining a local adjustment reference point correspondingto the i3-th character row lower boundary in the M local adjustmentreference points, wherein i3 is a positive integer less than or equal toM, i2 and i3 are not equal to each other; determining an i3-th characterrow corresponding to the i3-th character row lower boundary in the Mcharacter rows; determining a local character row area corresponding tothe i3-th character row according to the height of the character row andthe i3-th character row; determining multiple reference characteroffsets corresponding to the i3-th character row according to the i3-thcharacter row lower boundary and the local adjustment reference pointcorresponding to the i3-th character row lower boundary; and in responseto that the local character row area corresponding to the i2-thcharacter row partially overlaps the local character row areacorresponding to the i3-th character row: for an overlapped area betweenthe local character row area corresponding to the i2-th character rowand the local character row area corresponding to the i3-th characterrow, determining a local adjustment offset of each of pixels in theoverlapped area according to the multiple reference character offsetscorresponding to the i2-th character row and the multiple referencecharacter offsets corresponding to the i3-th character row, for each ofpixels in a non-overlapped area outside the overlapped area in a localcharacter area corresponding to the i2-th character row, determining alocal adjustment offset corresponding to each of the pixels in thenon-overlapped area of the local character row area corresponding to thei2-th character row according to the multiple reference characteroffsets corresponding to the i2-th character row and the retentioncoefficient group corresponding to the local character row areacorresponding to the i2-th character row in the M retention coefficientgroups, wherein the local adjustment offset group corresponding to thei2-th character row in the M local adjustment offset groups comprisesthe local adjustment offset corresponding to each of the pixels in thenon-overlapped area of the local character row area corresponding to thei2-th character row and the local adjustment offset of each of thepixels in the overlapped area; and for each of the pixels in thenon-overlapped area outside the overlapped area in a local character rowarea corresponding to the i3-th character row, determining a localadjustment offset corresponding to each of the pixels in thenon-overlapped area in the local character row area corresponding to thei3-th character row according to the multiple reference characteroffsets corresponding to the i3-th character row and the retentioncoefficient groups corresponding to the local character row areacorresponding to the i3-th character row in the M coefficient groups,wherein the local adjustment offset group corresponding to the i3-thcharacter row in the M local adjustment offset groups comprises thelocal adjustment offset corresponding to each of the pixels in thenon-overlapped area of the local character row area corresponding to thei3-th character row and the local adjustment offset of each of thepixels in the overlapped area.
 6. The image processing method accordingto claim 4, wherein the step of determining the M local adjustmentreference points corresponding to the M character row lower boundariesaccording to the local adjustment reference line comprises: for each ofthe M character row lower boundaries, under a condition that there is anintersection between the character row lower boundary and the localadjustment reference line, determining the local adjustment referencepoint corresponding to the character row lower boundary as theintersection; and under a condition that there is no intersectionbetween the character row lower boundary and the local adjustmentreference line, determining the local adjustment reference pointcorresponding to the character row lower boundary as a point on thecharacter row lower boundary closest to the local adjustment referenceline.
 7. The image processing method according to claim 1, wherein avalue range of the retention coefficient in each of the retentioncoefficient groups is 0 to 1, and the step of determining the Mretention coefficient groups comprises: for an i4-th character row inthe M character rows, determining a local character row areacorresponding to the i4-th character row, wherein i4 is a positiveinteger less than or equal to M; for each of pixels in the localcharacter row area, obtaining a point on the character row lowerboundary corresponding to the i4-th character row closest to the pixelin the local character row area as a reference pixel, determining anattenuation value corresponding to the pixel in the local character rowarea according to a distance between the pixel in the local characterrow area and the reference pixel, and determining a retentioncoefficient corresponding to the pixel in the local character row areaaccording to the attenuation value, thereby determining the retentioncoefficient group corresponding to the local character row areacorresponding to the i4-th character row, wherein the M retentioncoefficient groups comprise the retention coefficient groupcorresponding to the local character row area corresponding to the i4-thcharacter row.
 8. The image processing method according to claim 1,wherein the M character rows are arranged along a first direction, andthe step of determining the local adjustment reference line comprises:using a middle line extending in along first direction in theintermediate corrected image as the local adjustment reference line. 9.The image processing method according to claim 1, wherein the step ofperforming the local adjustment on the M character rows in theintermediate corrected image according to the M local adjustment offsetgroups to obtain the target corrected image comprises: determining alocal character row area corresponding to the M character rows in theintermediate corrected image; and performing a linear local adjustmenton pixels in the local character row area corresponding to the Mcharacter rows respectively to obtain the target corrected imageaccording to the M local adjustment offset groups.
 10. The imageprocessing method according to claim 1, wherein the step of performingthe global correction processing on the input image to obtain theintermediate corrected image comprises: performing a binarizationprocessing on the input image to obtain a binarized image; performing acharacter connection processing on the binarized image to obtain asecond character connected image, wherein the second character connectedimage comprises M second character connected areas corresponding to theM character rows; acquiring M middle lines corresponding to the M secondcharacter connected areas one-to-one, wherein the M second characterconnected areas are arranged along the first direction; setting W firstdivision lines, wherein the W first division lines extend along thefirst direction; acquiring multiple first intersections between the Mmiddle lines and the W first division lines; performing a quadraticfitting based on the multiple first intersections to obtain W quadraticfunctions corresponding to the W first division lines one-to-one;setting Q second division lines, wherein the Q second division linesextend along a second direction, and the first direction and the seconddirection are perpendicular to each other; obtaining multiple secondintersections between the W first division lines and the Q seconddivision lines; calculating a global adjustment offset of the multiplesecond intersections based on the W quadratic functions; and performingthe global correction processing on the binarized image according to theglobal adjustment offset of the multiple second intersections to obtainthe intermediate corrected image.
 11. The image processing methodaccording to claim 10, wherein the step of performing the quadraticfitting based on the multiple first intersections to obtain the Wquadratic functions corresponding to the W first division linesone-to-one comprises: determining a coordinate system based on the inputimage, wherein the coordinate system comprises an X axis and a Y axis,the first direction is parallel to the Y axis, and the second directionis parallel to the X axis; determining a coordinate value of multiplecharacter center points corresponding to the multiple firstintersections in the coordinate system; calculating a global adjustmentoffset of the multiple first intersections based on the multiplecharacter center points; and performing the quadratic fitting on theglobal adjustment offset of the multiple first intersections to obtainthe W quadratic functions corresponding to the W first division linesone-to-one.
 12. The image processing method according to claim 11,wherein for each of the multiple first intersections, the globaladjustment offset of the first intersection comprises a differencebetween a Y-axis coordinate value of the first intersection in thecoordinate system and a Y-axis coordinate value of the character centerpoint corresponding to the first intersection in the coordinate system.13. An image processing device, comprising: an acquisition moduleconfigured to obtain an input image, wherein the input image comprises Mcharacter rows, and each of the M character rows comprises at least onecharacter, and M is a positive integer; a global correction module,configured to perform a global correction processing on the input imageto obtain an intermediate corrected image; and a local adjustment moduleconfigured to perform a local adjustment on the intermediate correctedimage to obtain a target corrected image; wherein the step of performinglocal adjustment on the intermediate corrected image by the localadjustment module to obtain the target corrected image comprises thefollowing operations: determining M character row lower boundariescorresponding to the M character rows according to the intermediatecorrected image; determining a local adjustment reference line and Mretention coefficient groups based on the intermediate corrected imageand the M character row lower boundaries, wherein each of the Mretention coefficient groups comprises multiple retention coefficients;determining M local adjustment offset groups corresponding to the Mcharacter rows according to the M character row lower boundaries, thelocal adjustment reference line and the M retention coefficient groups,wherein each of the M local adjustment offset groups comprises multiplelocal adjustment offsets; and performing the local adjustment on the Mcharacter rows in the intermediate corrected image according to the Mlocal adjustment offset groups to obtain the target corrected image. 14.The image processing device according to claim 13, wherein the operationof determining, by the local adjustment module, the M character rowlower boundaries corresponding to the M character rows according to theintermediate corrected image comprises: performing a characterconnection processing on the intermediate corrected image to obtain afirst character connected image, wherein the first character connectedimage comprises M first character connected areas corresponding to the Mcharacter rows; and determining the M character row lower boundariescorresponding to the M character rows according to the M first characterconnected areas and the intermediate corrected image.
 15. The imageprocessing device according to claim 14, wherein the operation ofdetermining, by the local adjustment module, the M character row lowerboundaries corresponding to the M character rows according to the Mfirst character connected areas and the intermediate corrected imagecomprises: determining M area lower boundaries corresponding to the Mfirst character connected areas one-to-one; and performing a boundaryfitting processing on the M character rows to obtain the M character rowlower boundaries according to the M area lower boundaries and theintermediate corrected image, wherein the M character rows comprise ani1-th character row, the i1-th character row corresponds to the firstcharacter connected area which corresponds to a lower boundary of theit-th area in the M area lower boundaries, it is a positive integer lessthan or equal to M, the operation of performing the boundary fittingprocess on the i1-th character row comprises: obtaining at least onepixel of each of the at least one character in the i1-th character rowclosest to the lower boundary of the i1-th area; removing a noise pixelin the at least one pixel to obtain a target pixel; and performing alinear or quadratic fitting on the target pixel to obtain the characterrow lower boundary corresponding to the i1-th character row.
 16. Theimage processing device according to claim 13, wherein the operation ofdetermining, by the local adjustment module, the M local adjustmentoffset groups corresponding to the M character rows according to the Mcharacter row lower boundaries, the local adjustment reference line andthe M retention coefficient groups comprises: determining M localadjustment reference points corresponding to the M character row lowerboundaries according to the local adjustment reference line; for ani2-th character row lower boundary in the M character row lowerboundaries, determining a local adjustment reference point correspondingto the i2-th character row lower boundary in the M local adjustmentreference points, wherein i2 is a positive integer less than or equal toM; determining an i2-th character row corresponding to the i2-thcharacter row lower boundary in the M character rows; determining alocal character row area corresponding to the i2-th character rowaccording to a height of the character row and the i2-th character row;determining multiple reference character offsets corresponding to thei2-th character row lower boundary according to the i2-th character rowlower boundary and the local adjustment reference point corresponding tothe i2-th character row lower boundary; and in response to that thelocal character row area corresponding to the i2-th character row doesnot overlap a local character row area corresponding to any one ofremaining character row in the M character rows, determining the localadjustment offset corresponding to each of pixels in the local characterrow area corresponding to the i2-th character row according to themultiple reference character offsets corresponding to the i2-thcharacter row and the retention coefficient group corresponding to thelocal character row area corresponding to the i2-th character row in theM retention coefficient groups, wherein the M local adjustment offsetgroups comprise a local adjustment offset group corresponding to thei2-th character row, and the local adjustment offset group correspondingto the i2-th character row comprises the local adjustment offsetcorresponding to each of the pixels in the local character row areacorresponding to the i2-th character row.
 17. The image processingdevice according to claim 16, wherein the operation of determining, bythe local adjustment module, the M local adjustment offset groupscorresponding to the M character rows according to the M character rowlower boundaries, the local adjustment reference line and the Mretention coefficient groups further comprises: for an i3-th characterrow lower boundary in the M character row lower boundaries, determininga local adjustment reference point corresponding to the i3-th characterrow lower boundary in the M local adjustment reference points, whereini3 is a positive integer less than or equal to M, i2 and i3 are notequal to each other; determining an i3-th character row corresponding tothe i3-th character row lower boundary in the M character rows;determining a local character row area corresponding to the i3-thcharacter row according to the height of the character row and the i3-thcharacter row; determining multiple reference character offsetscorresponding to the i3-th character row according to the i3-thcharacter row lower boundary and the local adjustment reference pointcorresponding to the i3-th character row lower boundary; and in responseto that the local character row area corresponding to the i2-thcharacter row partially overlaps the local character row areacorresponding to the i3-th character row: for an overlapped area betweenthe local character row area corresponding to the i2-th character rowand the local character row area corresponding to the i3-th characterrow, determining a local adjustment offset of each of pixels in theoverlapped area according to the multiple reference character offsetscorresponding to the i2-th character row and the multiple referencecharacter offsets corresponding to the i3-th character row; for each ofpixels in a non-overlapped area outside the overlapped area in a localcharacter area corresponding to the i2-th character row, determining alocal adjustment offset corresponding to each of the pixels in thenon-overlapped area of the local character row area corresponding to thei2-th character row according to the multiple reference characteroffsets corresponding to the i2-th character row and the retentioncoefficient group corresponding to the local character row areacorresponding to the i2-th character row in the M retention coefficientgroups, wherein the local adjustment offset group corresponding to thei2-th character row in the M local adjustment offset groups comprisesthe local adjustment offset corresponding to each of the pixels in thenon-overlapped area of the local character row area corresponding to thei2-th character row and the local adjustment offset of each of thepixels in the overlapped area; and for each of the pixels in thenon-overlapped area outside the overlapped area in a local character rowarea corresponding to the i3-th character row, determining a localadjustment offset corresponding to each of the pixels in thenon-overlapped area in the local character row area corresponding to thei3-th character row according to the multiple reference characteroffsets corresponding to the i3-th character row and the retentioncoefficient groups corresponding to the local character row areacorresponding to the i3-th character row in the M coefficient groups,wherein the local adjustment offset group corresponding to the i3-thcharacter row in the M local adjustment offset groups comprises thelocal adjustment offset corresponding to each of the pixels in thenon-overlapped area of the local character row area corresponding to thei3-th character row and the local adjustment offset of each of thepixels in the overlapped area.
 18. The image processing device accordingto claim 13, wherein the operation of performing, by the globalcorrection module, the global correction processing on the input imageto get the intermediate corrected image comprises: performing abinarization processing on the input image to obtain a binarized image;performing a character connection processing on the binarized image toobtain a second character connected image, wherein the second characterconnected image comprises M second character connected areascorresponding to the M character rows; obtaining M middle linescorresponding to the M second character connected areas one-to-one,wherein the M second character connected areas are arranged along thefirst direction; setting W first division lines, wherein the W firstdivision lines extend along the first direction; acquiring multiplefirst intersections between the M middle lines and the W first divisionlines; performing a quadratic fitting based on the multiple firstintersections to obtain W quadratic functions corresponding to the Wfirst division lines one-to-one; setting Q second division lines,wherein the Q second division lines extend along a second direction,wherein the first direction is perpendicular to the second direction;obtaining multiple second intersections between the W first divisionlines and the Q second division lines; calculating a global adjustmentoffset of the multiple second intersections based on the W quadraticfunctions; and performing the global correction processing on thebinarized image according to the global adjustment offset of themultiple second intersections, so as to get the intermediate correctedimage.
 19. An electronic device, comprising: a memory, configured tostore computer-readable instructions non-temporarily; and a processor,configured to execute the computer-readable instructions, wherein theimage processing method as claimed in claim 1 is implemented when thecomputer-readable instructions are executed by the processor.
 20. Anon-transitory computer readable storage medium, wherein thenon-transitory computer readable storage medium stores computer-readableinstructions, wherein the image processing method as claimed in claim 1is implemented when the computer-readable instructions are executed by aprocessor.